package sigeco.model.facade;

import java.util.List;

import javax.ejb.Stateless;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import sigeco.model.Matrix;

@Stateless(name="MatrixFacade")
public class MatrixFacadeBean implements MatrixFacadeLocal {
    @PersistenceContext(unitName="Model")
    private EntityManager em;

    public MatrixFacadeBean() {
    }

    public Object mergeEntity(Object entity) {
        return em.merge(entity);
    }

    public Object persistEntity(Object entity) {
        em.persist(entity);
        return entity;
    }

    /** <code>select c from Matrix c</code> */
    public List<Matrix> queryMatrixFindAll() {
        return em.createNamedQuery("Matrix.findAll").getResultList();
    }

    public void removeMatrix(Matrix matrix) {
        matrix = em.find(Matrix.class, matrix.getId());
        em.remove(matrix);
    }
}
